/**
 * @description: 房间管理
 */
import request from '@/config/axios'

export const getRoomListApi = (params: any): Promise<IResponse> => {
  return request.get({ url: '/location/room/room', params })
}

export const addRoomApi = (data: any): Promise<IResponse> => {
  return request.post({
    url: '/location/room/room',
    data
  })
}

export const updateRoomApi = (id: number, data: any): Promise<IResponse> => {
  if (id === undefined || id === null) {
    throw new Error('更新房间时ID不能为空')
  }
  return request.put({ url: `/location/room/room/${id}`, data })
}

export const delRoomListApi = (data: number[]): Promise<IResponse> => {
  return request.delete({ url: `/location/room/room`, data })
}

export const getRoomApi = (dataId: number): Promise<IResponse> => {
  return request.get({ url: `/location/room/room/${dataId}` })
}
